<div class="information">
	<?php echo $fail_items['success_count']?>
	records have sucessfully added into database.
</div>

<?php 
if (sizeof($fail_items) > 1){
	
	$type = array();
	
	foreach ($item_type as $temp){
		$type[$temp->item_type_id] = $temp->item_type_name;
	}
	
	echo '<div class="errorTitle">'.(sizeof($fail_items)-1).' items are failed to add into database</div>';
	echo '<div class="errorTable">';
	echo '<table>';
	echo '<tr>';
	echo '<td width="200">name</td>';
	echo '<td width="50">barcode</td>';
	echo '<td width="30">type</td>';
	echo '<td width="130">category</td>';
	echo '<td width="130">manufacturer</td>';
	echo '<td width="50">cost</td>';
	echo '<td width="50">price</td>';
	echo '<td width="50">current stock</td>';
	echo '<td width="50">mininum stock</td>';
	echo '<td width="50">bundle unit</td>';
	echo '<td width="400">Error Message</td>';
	echo '</tr>';
	for($i = 0; $i < sizeof($fail_items) - 1; $i++){
		$error = $fail_items[$i];
		echo '<tr>';
		echo '<td>'.$error['name'].'</td>';
		echo '<td>'.$error['barcode'].'</td>';
		echo '<td>'.$type[$error['type']].'</td>';
		echo '<td>'.$error['category'].'</td>';
		echo '<td>'.$error['manufacturer'].'</td>';
		echo '<td>'.$error['cost'].'</td>';
		echo '<td>'.$error['price'].'</td>';
		echo '<td>'.$error['curr_stock'].'</td>';
		echo '<td>'.$error['min_stock'].'</td>';
		echo '<td>'.$error['bundle_unit'].'</td>';
		echo '<td>'.$error['error_message'].'</td>';
		echo '</tr>';
	}
	echo '</table>';
	echo '</div>';
}
?>